/**
 * Copyright (c) 2009-2011, chunquedong(YangJiandong)
 * 
 * This file is part of ChunMap project
 * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE(Version >=3)
 * 
 * History:
 *     2010-05-05  Jed Young  Creation
 */
package chunmap.view.layer;

import chunmap.data.feature.Feature;
import chunmap.data.feature.FeatureCollection;
import chunmap.data.feature.VisitAction;
import chunmap.model.elem.Envelope;
import chunmap.view.Renderer;
import chunmap.view.render.Symbol;

/**
 * @author chunquedong
 * 
 */
public class VectorLayer extends AbstractLayer {

	private boolean selectabel;
	public boolean isSelectabel() {return selectabel;}
	public void setSelectabel(boolean selectabel) {this.selectabel = selectabel;}
	
	private FeatureCollection features;
	public FeatureCollection getFeatures() {return features;}
	public void setFeatures(FeatureCollection features) {this.features = features;}
	

	public VectorLayer(FeatureCollection features) {
		this.features = features;
		selectabel = true;
	}

	@Override
	protected void subRender(final Symbol smb,final int i,final Renderer r) {
		features.select(r.getFilterEnvelop(), new VisitAction(){
			@Override
			public void execute(Feature obj) {
				r.draw(obj, smb,i);
			}});
	}

	@Override
	public Envelope getEnvelop() {
		return features.getEnvelope();
	}
}